package com.pearadmin.modules.sys.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pearadmin.common.web.domain.request.PageDomain;
import com.pearadmin.modules.sys.domain.WorkFixDetail;
import com.pearadmin.modules.sys.mapper.WorkFixDetailMapper;
import com.pearadmin.modules.sys.service.IWorkFixDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 维修类型详情Service业务层处理
 *
 * @author Mr.Ling
 * @date 2021-12-17
 */
@Service
public class WorkFixDetailServiceImpl implements IWorkFixDetailService {
    @Autowired
    private WorkFixDetailMapper workFixDetailMapper;

    /**
     * 查询维修类型详情
     *
     * @param id 维修类型详情ID
     * @return 维修类型详情
     */
    @Override
    public WorkFixDetail selectWorkFixDetailById(String id) {
        return workFixDetailMapper.selectWorkFixDetailById(id);
    }

    /**
     * 查询维修类型详情列表
     *
     * @param workFixDetail 维修类型详情
     * @return 维修类型详情
     */
    @Override
    public List<WorkFixDetail> selectWorkFixDetailList(WorkFixDetail workFixDetail) {
        return workFixDetailMapper.selectWorkFixDetailList(workFixDetail);
    }

    /**
     * 查询维修类型详情
     *
     * @param workFixDetail 维修类型详情
     * @param pageDomain
     * @return 维修类型详情 分页集合
     */
    @Override
    public PageInfo<WorkFixDetail> selectWorkFixDetailPage(WorkFixDetail workFixDetail, PageDomain pageDomain) {
        PageHelper.startPage(pageDomain.getPage(), pageDomain.getLimit());
        List<WorkFixDetail> data = workFixDetailMapper.selectWorkFixDetailList(workFixDetail);
        return new PageInfo<>(data);
    }

    /**
     * 新增维修类型详情
     *
     * @param workFixDetail 维修类型详情
     * @return 结果
     */

    @Override
    public int insertWorkFixDetail(WorkFixDetail workFixDetail) {
        return workFixDetailMapper.insertWorkFixDetail(workFixDetail);
    }

    /**
     * 修改维修类型详情
     *
     * @param workFixDetail 维修类型详情
     * @return 结果
     */
    @Override
    public int updateWorkFixDetail(WorkFixDetail workFixDetail) {
        return workFixDetailMapper.updateWorkFixDetail(workFixDetail);
    }

    /**
     * 删除维修类型详情对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWorkFixDetailByIds(String[] ids) {
        return workFixDetailMapper.deleteWorkFixDetailByIds(ids);
    }

    /**
     * 删除维修类型详情信息
     *
     * @param id 维修类型详情ID
     * @return 结果
     */
    @Override
    public int deleteWorkFixDetailById(String id) {
        return workFixDetailMapper.deleteWorkFixDetailById(id);
    }

    @Override
    public List<WorkFixDetail> getFixDetailByFixId(String fixId) {
        return workFixDetailMapper.getByFixId(fixId);
    }
}
